package nodes.command;

import java.util.List;
import parser.ParserException;
import model.Model;
import model.Turtle;
import nodes.AbstractNode;
import nodes.VariableNode;


/**
 * Sets the turtle to invisible
 */
public class HideturtleC extends AbstractCommand
{
    public AbstractNode evaluate (List<AbstractNode> myArguments, Model model)
    {
        if (myArguments.size() != Integer.parseInt(resources.getString("hideturtle")))
        {
            throw ParserException.BAD_ARGUMENTS;
        }

        for(Turtle currentTurtle : model.getActiveTurtles())
        {
            currentTurtle.setVisibility(false);
        }
        
        return new VariableNode(FALSE_VARIABLE_NAME,model);
    }
}
